import type { UserConfig } from 'vite';

import Windicss from 'vite-plugin-windicss';
import Icons, { ViteIconsResolver } from 'vite-plugin-icons'
import Components from 'vite-plugin-components';

const config: UserConfig = {
  // 在预构建中强制排除的依赖项
  optimizeDeps: {
    exclude: ['vue-demi', '@vueuse/shared', '@vueuse/core'],
  },
  plugins: [
    Windicss({
      // 是否开启预检
      preflight: false
    }),
    Icons(), 
    Components({
      dirs: ['.vitepress/theme/components'],
      customLoaderMatcher: (id) => id.endsWith('.md'),
      customComponentResolvers:  [
        ViteIconsResolver({
          componentPrefix: '',
        })
      ]
    })
  ]
}

export default config;